Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 7 - View-Related Objects / View-Related Objects Reference
View Device Functions / Measuring the Colors and Pattern Width of a Shape on a Device


GXGetShapeDeviceColors

You can use the GXGetShapeDeviceColors function to determine the set of colors with which a shape will be drawn on a given view device, as well as the width of any repeating pattern with which the shape will be drawn.

gxColorSet GXGetShapeDeviceColors(gxShape source, 
                                 gxViewPort port, 
                                 gxViewDevice device, 
                                 long *width);
source
A reference to the shape whose colors you wish to determine.
port
A reference to a view port to which the shape is drawn.
device
A reference to the view device on which the shape is drawn.
width
A pointer to a long value. On return, the value is the width of the repeated pattern formed by dithering or halftoning, or by the pattern--if any--specified in the shape's style object.
function result
A reference to a color set that contains the colors with which the shape can be drawn.
DESCRIPTION
The GXGetShapeDeviceColors function returns a color set containing the colors that the shape would be drawn with through the view port onto the view device. The view port must be in the view port list of the shape's transform object. If no shape sharing the ink of the source shape intersects the view port and view device, the function returns nil.

The GXGetShapeDeviceColors function returns only the number of unique colors in the dither pattern or the halftone pattern, not the size of the dither or the halftone. It also does not take transfer modes into account, or the colors already on the view device.

This function does not check that the shape actually intersects the view device; you may want to call the GXGetShapeGlobalViewDevices function first. The shape object cannot be a bitmap or picture shape.

ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
shape_is_nil 
invalid_viewPort_reference 
invalid_viewDevice_reference 
SEE ALSO
For information about color sets, see "When Color Matching Occurs" beginning on page 4-31.

For information about dithers and halftones, see the sections "Dither" beginning on page 7-10 and "Halftone" beginning on page 7-13.

Patterns and the style object are described in the geometric styles chapter of Inside Macintosh: QuickDraw GX Graphics.

To determine the view devices that a shape is displayed on, use the GXGetShapeGlobalViewDevices function, described on page 7-115.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996